package com.fly.springbootTemplate.controller;

import com.fly.springbootTemplate.entity.Teacher;
import com.fly.springbootTemplate.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;
    @RequestMapping("/addTeacher")
    public boolean addTeacher(Teacher teacher) {
        return teacherService.addTeacher(teacher);
    }
    @RequestMapping("/deleteTeacher")
    public boolean deleteTeacher(String teacherId) {
        return teacherService.deleteTeacher(teacherId);
    }
    @RequestMapping("/updateTeacher")
    public boolean updateTeacher(Teacher teacher) {
        return teacherService.updateTeacher(teacher);
    }
    @RequestMapping("/getAllTeacher")
    public List<Teacher> getAllTeacher() {
        return teacherService.getAllTeachers();
    }
    @RequestMapping("/getTeacherById")
    public Teacher getTeacherById(String teacherId) {
        return teacherService.getTeacherById(teacherId);
    }
    @RequestMapping("/getTeacherByName")
    public List<Teacher> getTeacherByName(String teacherName) {
        return teacherService.getTeacherByName(teacherName);
    }
}
